import unittest
import greedy_algorithm as greedy


class MyTestCase(unittest.TestCase):
    def test_schedule(self):
        courses = [
            {'name': 'Algorithm', 'start': 9, 'end': 11},
            {'name': 'Operating System', 'start': 11, 'end': 13},
            {'name': 'computer architecture', 'start': 8, 'end': 10},
            {'name': 'software engineering', 'start': 10, 'end': 12},
            {'name': 'database system', 'start': 13, 'end': 15},
            {'name': 'artificial intelligence', 'start': 15, 'end': 17},
            {'name': 'networks', 'start': 14, 'end': 16},
            {'name': 'cryptography', 'start': 16, 'end': 18},
            {'name': 'machine learning', 'start': 17, 'end': 19},
            {'name': 'data science', 'start': 12, 'end': 14}
        ]
        result = greedy.schedule(courses)
        for course in result:
            print(course['name'], course['start'], course['end'])

    def test_set_covered(self):
        states_needed = {'mt', 'wa', 'or', 'id', 'nv', 'ut', 'ca', 'az'}
        stations = {'kone': {'id', 'nv', 'ut'}, 'ktwo': {'wa', 'id', 'mt'}, 'kthree': {'or', 'nv', 'ca'},
                    'kfour': {'nv', 'ut'}, 'kfive': {'ca', 'az'}}
        print(greedy.set_cover_solution(states_needed, stations))


if __name__ == '__main__':
    unittest.main()
